import React from 'react';
const handler1 = () => {
    console.log('button1 被点击');
};
const handler2 = () => {
    console.log('button2 被点击');
};
export default () => {
    React.useEffect(() => {
        const button1 = document.getElementById('button1') as HTMLElement;
        const button2 = document.getElementById('button2') as HTMLElement;
        const listener = new WeakMap();

        listener.set(button1, handler1);
        listener.set(button2, handler2);
        button1.addEventListener('click', listener.get(button1), false);
        button2.addEventListener('click', listener.get(button2), false);
    }, []);
    return (
        <div>
            <button id="button1">按钮1</button>
            <button id="button2">按钮2</button>
        </div>
    );
};
